package edu.demo.recommend.exception;

import edu.demo.recommend.common.ResultCodeEnum;

/**
 * 自定义的异常类：描述推荐系统中的业务异常
 * @author hb
 */
public class RecommendBusinessException extends RuntimeException {
    private Integer code;

    public RecommendBusinessException( Integer code,String message) {
        super(message);
        this.code = code;
    }

    public RecommendBusinessException( ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    public RecommendBusinessException( ResultCodeEnum resultCodeEnum,String message) {
        super(message);
        this.code = resultCodeEnum.getCode();
        resultCodeEnum.setMessage(message);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
